<?php


namespace App\Api\Controllers;



use App\Api\Repositories\AddrRepositorie;
use App\Api\Services\JsonService;
use Illuminate\Http\Request;

class AddrController extends \App\Api\Manages\CommonController
{
    //查询用户地址列表
    public function getArrdList(Request $request)
    {
        //获取用户ID
        $validat = $request->validate([
            'uid' => ['required'],
        ]);
        //根据用户ID查询手机号
        $phone = AddrRepositorie::byIdToPhone((int)$validat['uid']);
        //根据手机号查询地址
        $addr = AddrRepositorie::byPhoneToAddr($phone);
        if(empty($addr)){
            return JsonService::fail('您的地址为空','',1002);
        }else{
            return JsonService::success('查询成功',$addr,1000);
        }
    }

}